package com.mettle.loyaltycard.parser;

import java.io.IOException;
import java.text.ParseException;
import java.util.Collection;

import com.mettle.loyaltycard.model.Customer;
import com.mettle.loyaltycard.model.LoyaltyCard;
import com.mettle.loyaltycard.model.Transaction;

public class Displayer {
	public static void main(String[] args) throws IOException, ParseException {
		Collection<LoyaltyCard> loyaltyCards = InputFileParser.getCards("/home/abhinav/Desktop/data").values();
		for (LoyaltyCard loyaltyCard : loyaltyCards) {
			Customer customer = loyaltyCard.getCustomer();
			System.out.println("Customer Name: " + customer.getName());
			System.out.println("Customer Email: " + customer.getEmail());
			System.out.println("Loyalty Points: " + loyaltyCard.getLoyaltyPoints());
			System.out.println("Customer Class: " + loyaltyCard.getMembershipType());
			System.out.println("Transactions: ");
			for (Transaction eachTransaction : loyaltyCard.getTransactions()) {
				System.out.print("\t" + eachTransaction.getPurchaseDate());
				System.out.print("\t" + eachTransaction.getTransactionId());
				System.out.print("\t" + eachTransaction.getPurchaseAmount());
				System.out.println("\t" + eachTransaction.getPointsEarned());
			}
			System.out.println();
		}
	}
}
